<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
</head>
<body>
  <div id="app">
      <img :src="src" alt="" @click='changeImg'>
  </div>
  <script src="./vue.js"></script>
  <script>
    var vm = new Vue({
      el:'#app',
      data:{
          src2: './img/1.png',
          src1:'./img/2.png',
          src: './img/2.png',
          flag:true
      },
      methods:{
          changeImg() {
            if(this.flag) {
                this.src = this.src1;
                this.flag = false
            } else {
                this.src = this.src2;
                this.flag = true
            }
          }
      }
     });
  </script>
</body>
</html>
